package com.example.demo.controller;

import com.example.demo.model.ListConfig;
import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
@Controller
public class UserController {
    // 获取配置文件中的端口号
//    @Value("${server.port}")
//    private Integer port;

    @Value("${string.str1}")
    private String str1;

    @Value("${string.str2}")
    private String str2;

    @Value("${string.str3}")
    private String str3;

    // 使用 @Autowired 注入 Bean 对象
    @Autowired
    private Student student;

    @Autowired
    private ListConfig listConfig;

    @ResponseBody // 告诉服务器返回一个非静态页面的数据
    @RequestMapping("/hello") //设置路由地址，路由地址尽量不要大写混小写
    public String hello() {
        return "ListConfig : " + listConfig.getName();
    }
}
